home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.08 Aug 91 / Modeless SF Source / CStarterPane.p < prev    next >
Encoding:
Text File  |  1991-01-13  |  3.4 KB  |  142 lines  |  [TEXT/PJMM]

  1. {****************************************************}
  2. {}
  3. {        CStarterPane.p                                                                    }
  4. {}
  5. {        Pane methods for a typical application.                                            }
  6. {}
  7. {        Copyright © 1989, Symantec Corporation.  All rights reserved.            }
  8. {}
  9. {****************************************************}
  10.  
  11.  
  12. {***}
  13. { *}
  14. { *    Most applications will want a scrollable window, so this}
  15. { *    class is based on the class CPanorama. All the methods here}
  16. { *    would still apply to classes based directly on CPane.}
  17. { *}
  18. { ***}
  19.  
  20.  
  21. UNIT CStarterPane;
  22.  
  23. INTERFACE
  24.  
  25. USES
  26.     TCL, CSFDialogs, StarterIntf;
  27.  
  28. IMPLEMENTATION
  29.  
  30.  
  31. {**}
  32. { * IStarterPane}
  33. { *}
  34. { *    Initialize a StarterPane object.}
  35. { *}
  36. { **}
  37.  
  38. PROCEDURE CStarterPane.IStarterPane (anEnclosure: CView; aSupervisor: CBureaucrat; aWidth, aHeight, aHEncl, aVEncl: integer; aHSizing, aVSizing: SizingOption);
  39.     BEGIN
  40.         IPanorama(anEnclosure, aSupervisor, aWidth, aHeight, aHEncl, aVEncl, aHSizing, aVSizing);
  41.     END;
  42.  
  43.  
  44. {**}
  45. { * Draw}
  46. { *}
  47. { *    In this method, you draw whatever you need to display in}
  48. { *    your pane. The area parameter gives the portion of the }
  49. { *    pane that needs to be redrawn. Area is in frame coordinates.}
  50. { *}
  51. { **}
  52.  
  53. PROCEDURE CStarterPane.Draw (VAR area: Rect);
  54.  
  55.     BEGIN
  56.     { draw your stuff }
  57.     END;
  58.  
  59.  
  60. {**}
  61. { * DoClick}
  62. { *}
  63. { *    The mouse went down in the pane.}
  64. { *    In this method you do whatever is appropriate for your}
  65. { *    application. HitPt is given in frame coordinates. The other}
  66. { *    parameters, modiferKeys and when, are taken from the event}
  67. { *    record.}
  68. { *}
  69. { *    If you want to implement mouse tracking, this is the method}
  70. { *    to do it in. You need to create a subclass of CMouseTask and}
  71. { *    pass it in a TrackMouse message to the pane.}
  72. { *}
  73. { **}
  74.  
  75. PROCEDURE CStarterPane.DoClick (hitPt: Point; modifierKeys: integer; when: longint);
  76.  
  77.     BEGIN
  78.     { what happens when the mouse goes down }
  79.     END;
  80.  
  81.  
  82. {**}
  83. { * HitSamePart}
  84. { *}
  85. { *    Test whether pointA and pointB are in the same part.}
  86. { *    "The same part" means different things for different applications.}
  87. { *    In the inherited method, "the same part" means "in the same pane."}
  88. { *    If you want a different behavior, override this method. For instance,}
  89. { *    two points might be in the same part if they're within n pixels}
  90. { *    of each other.}
  91. { *}
  92. { *    PointA and pointB are both in frame coordinates.}
  93. { *}
  94. { **}
  95.  
  96. FUNCTION CStarterPane.HitSamePart (VAR pointA, pointB: Point): Boolean;
  97.  
  98.     BEGIN
  99.         HitSamePart := INHERITED HitSamePart(pointA, pointB);
  100.     END;
  101.  
  102.  
  103. {**}
  104. { * AdjustCursor}
  105. { *}
  106. { *    If you want the cursor to have a different shape in your pane,}
  107. { *    do it in this method. If you want a different cursor for different}
  108. { *    parts of the same pane, you'll need to change the mouseRgn like this:}
  109. { *        1. Create a region for the "special area" of your pane.}
  110. { *        2. Convert this region to global coordinates}
  111. { *        3. Set the mouseRgn to the intersection of this region}
  112. { *           and the original mouseRgn: SectRgn(mouseRgn, myRgn, mouseRgn);}
  113. { *}
  114. { *    The inherited method just sets the cursor to the arrow. If this is fine}
  115. { *    for you, don't override this method.}
  116. { *}
  117. { **}
  118.  
  119. PROCEDURE CStarterPane.AdjustCursor (where: Point; mouseRgn: RgnHandle);
  120.  
  121.     BEGIN
  122.         INHERITED AdjustCursor(where, mouseRgn);
  123.     END;
  124.  
  125.  
  126. {**}
  127. { * ScrollToSelection}
  128. { *}
  129. { *    If your pane is based on a Panorama (as this example is), you might}
  130. { *    want to define what it means to have a selection and what it means to}
  131. { *    scroll to that selection.}
  132. { *}
  133. { **}
  134.  
  135. PROCEDURE CStarterPane.ScrollToSelection;
  136.  
  137.     BEGIN
  138.     { scroll to the selection }
  139.     END;
  140.  
  141.  
  142. END.